import request from "@/utils/request";

import type { GetUserInfoApiResponse } from "./model/loginModel";

const enum Api {
  login = "/admin/acl/index/login",
  loginOut = "/admin/acl/index/logout",
  getUserInfo = "/admin/acl/index/info",
}

// 登录
export const loginApi = (username: string, password: string) => {
  return request.post<any, { token: string }>(Api.login, {
    username,
    password,
  });
};

// 退出登录
export const loginOutApi = () => {
  return request.post<any, null>(Api.loginOut);
};

// 获取用户数据
export const getUserInfoApi = () => {
  return request.get<any, GetUserInfoApiResponse>(Api.getUserInfo);
};
